<extend name="Public:base" />

<block name="content-wrapper">
	<!-- Content Wrapper. Contains page content -->
	<div class="content-wrapper">
		<!-- Content Header (Page header) -->
		<section class="content-header">
			<h1>
				课程详情
				<small>Course detail</small>
			</h1>
			<ol class="breadcrumb">
				<li>
					<a href="{:U('Index/index')}"> <i class="fa fa-dashboard"></i>
						首页
					</a>
				</li>
				<li>
					<a href="{:U('Course/index')}">课程管理</a>
				</li>
				<li class="active">课程详情</li>
			</ol>
		</section>

		<!-- Main content -->
		<section class="content">
			<div class="row col-sm-6 col-sm-offset-3">
				<div class="box">
					<div class="box-header with-border">
						<h3 class="box-title">表单</h3>
					</div>
					<!-- /.box-header -->
					<!-- form start -->
					<div class="box-body">
						<form id="form-detail" class="form-horizontal">
							<div class="form-group">
								<label class="col-sm-2 control-label">学院</label>
								<div class="col-sm-9">
									<select id="academy_id" class="form-control" disabled="disabled">
										<volist name="academies" id="vo">
											<eq name="vo.id" value="$academy_id">
												<option value="{$vo.id}" selected="selected">{$vo.name}</option>
											<else />
												<option value="{$vo.id}">{$vo.name}</option>
											</eq>					                    													
										</volist>
					                 </select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">专业</label>
								<div class="col-sm-9">
									<select id="major_id" class="form-control" disabled="disabled">
										<volist name="majors" id="vo">
											<eq name="vo.id" value="$major_id">
												<option value="{$vo.id}" selected="selected">{$vo.name}</option>
											<else />
												<option value="{$vo.id}">{$vo.name}</option>
											</eq>					                    													
										</volist>
					                 </select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">名称</label>
								<div class="col-sm-9">
									<input id="name" type="text" class="form-control" value="{$course['name']}" disabled="disabled">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">类型</label>
								<div class="col-sm-9">
									<php>$course_type_array = array('1' => '专业必修课', '2' => '专业选修课', '3' => '通识必修课', '4' => '通识选修课');</php>
									<select id="type" class="form-control" disabled="disabled">
										<volist name="course_type_array" key="k" id="vo">
											<eq name="k" value="$course.type">
												<option value="{$k}" selected="selected">{$vo}</option>
											<else />
												<option value="{$k}">{$vo}</option>
											</eq>
										</volist>
					                 </select>
								</div>
							</div>
						</form>
					</div>
					<!-- /.box-body -->
					<div class="box-footer">
						<a href="{:U('Course/index')}" type="button" class="btn btn-default pull-right">返回</a>
					</div>
					<!-- /.box-footer -->
				</div>				
			</div>

		</section>
		<!-- /.content -->
	</div>
	<!-- /.content-wrapper -->
</block>

<block name="additional-scripts">
	<script>
		$(function () {
			$('#academy_id').change(function() {
				var academy_id = $('#academy_id').val();
				$.post('__MODULE__/Class/getMajorsByAcademyId',
				{
					academy_id: academy_id
				},
				function(data, status) {
					$('#major_id').empty();
					var majors = data;
					for(var key in majors) {
						$('#major_id').append('<option value="' + majors[key]['id'] + '">' + majors[key]['name'] + '</option>');
					}
				});	
			});
		});
	</script>
</block>